208335a08cae610d3b5eaea75f5552efaf15477b,modules/swagger-core/src/main/java/io/swagger/util/ParameterProcessor.java,ParameterProcessor,applyAnnotations,#Swagger#Parameter#Type#List#,41
Before Change
}
}
if (helper.getMin() != null || helper.getDecimalMin() != null) {
p.setMinimum(helper.getMin() != null ? new Double(helper.getMin()) : helper.getDecimalMin());
if (helper.isMinExclusive()) {
p.setExclusiveMinimum(true);
}
}
if (helper.getMax() != null || helper.getDecimalMax() != null) {
p.setMaximum(helper.getMax() != null ? new Double(helper.getMax()) : helper.getDecimalMax());
if (helper.isMaxExclusive()) {
p.setExclusiveMaximum(true);
}
}
if (helper.getMinItems() != null) {
p.setMinItems(helper.getMinItems());
}
if (helper.getMaxItems() != null) {
p.setMaxItems(helper.getMaxItems());
}
if (helper.getMinLength() != null) {
p.setMinLength(helper.getMinLength());
}
if (helper.getMaxLength() != null) {
p.setMaxLength(helper.getMaxLength());
}
if (helper.getPattern() != null) {
p.setPattern(helper.getPattern());
}
if (helper.isRequired() != null) {
p.setRequired(true);
}
if(helper.getType() != null) {
p.setType(helper.getType());
}
if(helper.getFormat() != null) {
p.setFormat(helper.getFormat());
}
AllowableValues allowableValues = AllowableValuesUtils.create(param.getAllowableValues());
if (p.getItems() != null || param.isAllowMultiple()) {
if (p.getItems() == null) {
// Convert to array
final Map<PropertyBuilder.PropertyId, Object> args = new EnumMap<PropertyBuilder.PropertyId, Object>(PropertyBuilder.PropertyId.class);
args.put(PropertyBuilder.PropertyId.DEFAULT, p.getDefaultValue());
p.setDefaultValue(null);
args.put(PropertyBuilder.PropertyId.ENUM, p.getEnum());
p.setEnum(null);
args.put(PropertyBuilder.PropertyId.MINIMUM, p.getMinimum());
p.setMinimum(null);
args.put(PropertyBuilder.PropertyId.EXCLUSIVE_MINIMUM, p.isExclusiveMinimum());
p.setExclusiveMinimum(null);
args.put(PropertyBuilder.PropertyId.MAXIMUM, p.getMaximum());
p.setMaximum(null);
args.put(PropertyBuilder.PropertyId.EXCLUSIVE_MAXIMUM, p.isExclusiveMaximum());
args.put(PropertyBuilder.PropertyId.MIN_LENGTH, p.getMinLength());
p.setMinLength(null);
args.put(PropertyBuilder.PropertyId.MAX_LENGTH, p.getMaxLength());
p.setMaxLength(null);
args.put(PropertyBuilder.PropertyId.PATTERN, p.getPattern());
p.setPattern(null);
args.put(PropertyBuilder.PropertyId.EXAMPLE, p.getExample());
p.setExclusiveMaximum(null);
Property items = PropertyBuilder.build(p.getType(), p.getFormat(), args);
p.type(ArrayProperty.TYPE).format(null).items(items);
}
final Map<PropertyBuilder.PropertyId, Object> args = new EnumMap<PropertyBuilder.PropertyId, Object>(PropertyBuilder.PropertyId.class);
if (StringUtils.isNotEmpty(defaultValue)) {
args.put(PropertyBuilder.PropertyId.DEFAULT, defaultValue);
}
/**
* Use jsr-303 annotations (and other bean validation annotations) if present. This essentially implies
* that the bean validation constraints now apply to the items and not to the parent collection/array.
* Although this will work for swagger definition purposes, there is no default validator for many of
* the validator annotations when applied to a collection/array. For example, a @Min annotation applied
* to a List>Long< will result in a swagger definition which contains an array property with items
* of type number and having a 'minimum' validation constraint. However, there is no default bean
* validator for @Min when applied to a List>Long<, and the developer would need to implement such
* a validator themselves.
*/
if (helper.getMin() != null || helper.getDecimalMin() != null) {
args.put(PropertyBuilder.PropertyId.MINIMUM,
helper.getMin() != null ? new Double(helper.getMin()) : helper.getDecimalMin());
if (helper.isMinExclusive()) {
args.put(PropertyBuilder.PropertyId.EXCLUSIVE_MINIMUM, true);
}
}
if (helper.getMax() != null || helper.getDecimalMax() != null) {
args.put(PropertyBuilder.PropertyId.MAXIMUM,
helper.getMax() != null ? new Double(helper.getMax()) : helper.getDecimalMax());
if (helper.isMaxExclusive()) {
args.put(PropertyBuilder.PropertyId.EXCLUSIVE_MAXIMUM, true);
}
After Change
}
if (helper.getMax() != null) {
p.setMaximum(helper.getMax());
if (helper.isMaxExclusive()) {
p.setExclusiveMaximum(true);
}
}
if (helper.getMinItems() != null) {
p.setMinItems(helper.getMinItems());
}
if (helper.getMaxItems() != null) {
p.setMaxItems(helper.getMaxItems());
}
if (helper.getMinLength() != null) {
p.setMinLength(helper.getMinLength());
}
if (helper.getMaxLength() != null) {
p.setMaxLength(helper.getMaxLength());
}
if (helper.getPattern() != null) {
p.setPattern(helper.getPattern());
}
if (helper.isRequired() != null) {
p.setRequired(true);
}
if(helper.getType() != null) {
p.setType(helper.getType());
}
if(helper.getFormat() != null) {
p.setFormat(helper.getFormat());
}
AllowableValues allowableValues = AllowableValuesUtils.create(param.getAllowableValues());
if (p.getItems() != null || param.isAllowMultiple()) {
if (p.getItems() == null) {
// Convert to array
final Map<PropertyBuilder.PropertyId, Object> args = new EnumMap<PropertyBuilder.PropertyId, Object>(PropertyBuilder.PropertyId.class);
args.put(PropertyBuilder.PropertyId.DEFAULT, p.getDefaultValue());
p.setDefaultValue(null);
args.put(PropertyBuilder.PropertyId.ENUM, p.getEnum());
p.setEnum(null);
args.put(PropertyBuilder.PropertyId.MINIMUM, p.getMinimum());
p.setMinimum(null);
args.put(PropertyBuilder.PropertyId.EXCLUSIVE_MINIMUM, p.isExclusiveMinimum());
p.setExclusiveMinimum(null);
args.put(PropertyBuilder.PropertyId.MAXIMUM, p.getMaximum());
p.setMaximum(null);
args.put(PropertyBuilder.PropertyId.EXCLUSIVE_MAXIMUM, p.isExclusiveMaximum());
args.put(PropertyBuilder.PropertyId.MIN_LENGTH, p.getMinLength());
p.setMinLength(null);
args.put(PropertyBuilder.PropertyId.MAX_LENGTH, p.getMaxLength());
p.setMaxLength(null);
args.put(PropertyBuilder.PropertyId.PATTERN, p.getPattern());
p.setPattern(null);
args.put(PropertyBuilder.PropertyId.EXAMPLE, p.getExample());
p.setExclusiveMaximum(null);
Property items = PropertyBuilder.build(p.getType(), p.getFormat(), args);
p.type(ArrayProperty.TYPE).format(null).items(items);
}
final Map<PropertyBuilder.PropertyId, Object> args = new EnumMap<PropertyBuilder.PropertyId, Object>(PropertyBuilder.PropertyId.class);
if (StringUtils.isNotEmpty(defaultValue)) {
args.put(PropertyBuilder.PropertyId.DEFAULT, defaultValue);
}
/**
* Use jsr-303 annotations (and other bean validation annotations) if present. This essentially implies
* that the bean validation constraints now apply to the items and not to the parent collection/array.
* Although this will work for swagger definition purposes, there is no default validator for many of
* the validator annotations when applied to a collection/array. For example, a @Min annotation applied
* to a List>Long< will result in a swagger definition which contains an array property with items
* of type number and having a 'minimum' validation constraint. However, there is no default bean
* validator for @Min when applied to a List>Long<, and the developer would need to implement such
* a validator themselves.
*/
if (helper.getMin() != null) {
args.put(PropertyBuilder.PropertyId.MINIMUM,
helper.getMin());
if (helper.isMinExclusive()) {
args.put(PropertyBuilder.PropertyId.EXCLUSIVE_MINIMUM, true);
}